<template>
  <van-tabbar route>
    <van-tabbar-item icon="home-o" to="/home">首页</van-tabbar-item>
    <van-tabbar-item icon="coupon-o" to="/category">分类</van-tabbar-item>
    <van-tabbar-item icon="shopping-cart-o" to="/shopcart" :badge="(token === undefined || token === '') ? '' : shopcartNum">购物车</van-tabbar-item>
    <van-tabbar-item icon="friends-o" to="/mine">我的</van-tabbar-item>
  </van-tabbar>
</template>

<script lang="ts" setup>
import { UserToken, ShopcartNum } from '@/pinia/index'
import { storeToRefs } from 'pinia'

const store = UserToken()
const storeB = ShopcartNum()
const { token } = storeToRefs(store)
const { shopcartNum } = storeToRefs(storeB)
</script>
